#include "TwoTreeViewDragNDrop.h"
#include <QtWidgets/QApplication>
#include <QDockWidget>
#include "MyTreeWidget.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    TwoTreeViewDragNDrop w;

	// 2 tree view
	QDockWidget* dock1 = new QDockWidget("1", &w);
	MyTreeWidget* tree1 = new MyTreeWidget(dock1);
	dock1->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	dock1->setWidget(tree1);
	w.addDockWidget(Qt::LeftDockWidgetArea, dock1);

	QDockWidget* dock2 = new QDockWidget("2", &w);
	MyTreeWidget* tree2 = new MyTreeWidget(dock2);
	dock2->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
	dock2->setWidget(tree2);
	w.addDockWidget(Qt::LeftDockWidgetArea, dock2);

	// some test data
	QTreeWidgetItem* parentItem = new QTreeWidgetItem(tree1);
	parentItem->setText(0, "Test");
	parentItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled);
	for (int i = 0; i < 10; ++i)
	{
		QTreeWidgetItem* pItem = new QTreeWidgetItem(parentItem);
		pItem->setText(0, QString("Number %1").arg(i));
		pItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled);
		pItem->addChild(pItem);
	}

    w.show();
    return a.exec();
}
